﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AspZone.Commerce.Service;

namespace AspZone.Commerce.Web.Controllers
{
    public class CatalogComponentController : ComponentController
    {
        private ICatalogService catalogService;

        public CatalogComponentController()
        {
            // TODO: Use dependency injection to resolve these references. Currently, the asp.net mvc framework does not allow for
            // constructor injection. Wait for the next version to fix this.
            this.catalogService = new CatalogService(new AspZone.Commerce.Repositories.CategoryRepository(), new AspZone.Commerce.Repositories.ProductRepository());
        }

        public void CategoryMenu()
        {
            
            var data = this.catalogService.GetCategoryHierarchy();
            ViewDataDictionary d = new ViewDataDictionary();
            d.Add("Categories", data);

            RenderView("CategoryMenu.aspx", d);
        }
    }
}
